import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'

const routes = [
  {
    path: '/',
  },
  {
    name: 'bind',
    path: '/bind',
    component: () => import('@/views/bind/bind'),
    meta: {
      title: '登录',
    }
  },
  {
    name: 'building',
    path: '/building',
    component: () => import('@/views/bind/building'),
    meta: {
      title: '房屋列表',
    }
  },
  {
    name: 'bind-info',
    path: '/bind-info',
    component: () => import('@/views/bind/info'),
    meta: {
      title: '房主信息确认',
    }
  },
  {
    name: 'menu',
    path: '/menu',
    component: () => import('@/views/menu/menu'),
    meta: {
      title: '自查菜单',
    }
  },
  {
    name: 'inspection-check-self',
    path: '/inspection/check-self',
    component: () => import('@/views/inspection/checkSelf'),
    meta: {
      title: '自查记录',
    }
  },
  {
    name: 'inspection-check-self-detail',
    path: '/inspection/check-self-detail',
    component: () => import('@/views/inspection/checkSelfDetail'),
    meta: {
      title: '自查记录',
    }
  },
  {
    name: 'inspection-trouble',
    path: '/inspection/trouble',
    component: () => import('@/views/inspection/trouble'),
    meta: {
      title: '隐患整改',
    }
  },
  {
    name: 'inspection-trouble-dispose',
    path: '/inspection/trouble-dispose',
    component: () => import('@/views/inspection/troubleDispose'),
    meta: {
      title: '隐患整改',
    }
  },
  {
    name: 'inspection-data-collection',
    path: '/inspection/data-collection',
    component: () => import('@/views/inspection/dataCollection'),
    meta: {
      title: '采集房屋基本信息',
    }
  },
  {
    name: 'inspection-check-form',
    path: '/inspection/check-form',
    component: () => import('@/views/inspection/checkForm'),
    meta: {
      title: '隐患自查',
    }
  },
  {
    name: 'month-unchecked',
    path: '/month-unchecked',
    component: () => import('@/views/bind/monthUnchecked'),
    meta: {
      title: '房屋列表',
    }
  },
  {
    name: 'month-unchecked',
    path: '/month-unchecked',
    component: () => import('@/views/bind/monthUnchecked'),
    meta: {
      title: '房屋列表',
    }
  },
]
const router = createRouter({
  history: createWebHistory(process.env.VUE_APP_BASE_ROUTER),
  routes
})

router.beforeEach((to, from, next) => {
  document.title = to.meta.title
  next()
})

export default router
